package gtkwire.widget;

import gtkwire.*;

/** TESTAA : create hässäkkä
*GtkAspectFrame — A frame that constrains its child to a particular aspect ratio.
*/
public class GtkAspectFrame extends GtkFrame
{
	private float xalign;
	private float yalign;
	private float ratio;
	private boolean obayChild;

	public GtkAspectFrame( String label, float xalign, float yalign, float ratio, boolean obayChild )
        {
		super( null );//no create data for super
		this.widgetType = WT_GtkAspectFrame;
		this.label = label;
		this.xalign = xalign;
		this.yalign = yalign;
		this.ratio = ratio;
		this.obayChild = obayChild;
		gtkCreate();
        }

	public GtkAspectFrame( String name, GladeKey key )
        {
		super( name, key );
		this.widgetType = WT_GtkAspectFrame;
        }

	protected String[] getCreateData()
	{
		if( label == null ) return null;//kills super classes attempt to instantiate native gtk
						// because label becomes non-null only after
						// super constructors return 
		String[] msg = { 	label, Float.toString( xalign),
					Float.toString( yalign ),  Float.toString( ratio ),
					Boolean.toString( obayChild ) };
		return msg;
	}

	public void setFrameParams( float xalign, float yalign, float ratio, boolean obey_child )
	{
		String[] msg = { Float.toString( xalign ), Float.toString( yalign ),
					Float.toString( ratio ), Boolean.toString( obey_child )   };
		app().sendCommand( name, GTKWireCommand.SET_ASPECT_RATIO, msg );
	}

}//end class
